# Maintainer: Alexey Pavlov <alexpux@gmail.com>

_realname=openal

pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=1.15.1
pkgrel=2
pkgdesc="OpenAL audio library for use with opengl (mingw-w64)"
arch=('any')
url="http://connect.creativelabs.com/openal/"
license=('GPL2')
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc" "${MINGW_PACKAGE_PREFIX}-cmake")
options=('strip' 'staticlibs')
source=(http://kcat.strangesoft.net/openal-releases/openal-soft-$pkgver.tar.bz2)
md5sums=('ea83dec3b9655a27d28e7bc7cae9cd71')

build() {
  mkdir -p "${srcdir}/build-${MINGW_CHOST}" && cd "${srcdir}/build-${MINGW_CHOST}"

  mkdir -p ${pkgdir}${MINGW_PREFIX}
  pushd ${pkgdir}${MINGW_PREFIX} > /dev/null
  export PREFIX_WIN=`pwd -W`
  popd > /dev/null

  ${MINGW_PREFIX}/bin/cmake \
    -G"MSYS Makefiles" \
    -DCMAKE_INSTALL_PREFIX:PATH=${PREFIX_WIN} \
    -DEXAMPLES=OFF \
    ../openal-soft-${pkgver}
  make
}

package() {
  cd "${srcdir}/build-${MINGW_CHOST}"
  make install
}
